</head>
<body>
<div class="f-sep10"></div>
<div class="f-sep10"></div>
<div class="m-hd m-tabs">
<h2 class="u-tt">{$form_info.name}管理</h2>
	<div class="more"><a href="javascript:;" onClick="ajaxload();"><span class="icon">&#xf021;</span> 刷新</a></div>
    <ul>
        <li><a class="z-crt" href='<?php echo url("admin_list_content/index",array("fid"=>$form_info["id"])); ?>'><span class="icon">&#xf101;</span> {$form_info.name}列表</a></li>
		<li><a  href="<?php echo url('admin_list_content/add',array('fid'=>$form_info['id'])) ?>" ><span class="icon">&#xf101;</span>添加{$form_info.name}内容</a></li>
    </ul>
</div>
<div class="m-list-table">
<table class="m-table m-table-row tablesorter" id="table">
    <thead>
      <tr>
        <th width="50">选择</th>
        <th width="50">ID</th>
        <!--foreach:{$field_list $vo}-->
        <th>{$vo.name}</th>
        <!--{/foreach}-->
        <th class="cola">表单操作</th>
      </tr>
    </thead>
    <tbody>
    </tbody>
</table>
</div>
<div class="f-cb"></div>
<div class="g-foot-tool">
	<div class="m-tools "> <span class="u-btns">
		<button type="button" onClick="selectall('id[]');"  class="u-btn u-btn-c4 u-btn-sm">全选</button>
		<button type="button" onClick="audit(1);" class="u-btn u-btn-c4 u-btn-sm">删除</button>
		</span> </div>
	<div class="m-page" id="pages"></div>
</div>
<div class="f-cb"></div>
<form id="filter_form" style="display:none">
	<input name="fid" type="hidden" value="{$form_info.id}">
</form>
<div class="f-sep10" ></div>
<div class="f-sep10"></div>
</body>
<script>
var page;
var ajaxload = new function(){}; 
var selectall = new function(){}; 
var audit = new function(){}; 
var del = new function(){}; 
Do.ready('base','page','tip','dialog', function() {
	page = $("#pages").myPagination({
		pageCount:1,
		ajax: {
			on: true,
			pageCountId:'countpage',
			url: '{$url(admin_list_content/ajax_content_list)}',
			dataType: 'json',
			param:$('#filter_form').serialize(),
			ajaxStart: function() {
				$("#table tbody").html('<tr><td colspan="7"><center>正在加载...请稍候！</center></td></tr>'); 
			},
			callback: function(json) {
				setTimeout(function() {
					$("#table tbody").html(json.info);
				}, 200);
			}
		}
	});
	
	window.ajaxload = function ajaxload(){
		page.onLoad({
			param:$('#filter_form').serialize(),
		});
	};
	
	$(".images").powerFloat({
		targetMode: "ajax"
	});
	
	window.del = function del(id,obj) {
		ajaxpost({
		name:'确认要删除本条数据吗？',
		url:'{$url(admin_list_content/del)}',
		data:{id:id},
		tip:true,
		success:function(){
			$(obj).parent().parent().remove();
			}
		});
	}
	
	//选择
	window.selectall = function selectall(name){   
		$("[name='"+name+"']").each(function(){//反选   
		if($(this).attr("checked")){   
			  $(this).removeAttr("checked");   
		}else{   
			  $(this).attr("checked",'true');   
		}   
		})  
	}
	
	//批量操作
	window.audit = function audit(status){
		var str="";
		$("[name='id[]']").each(function(){//反选   
		if($(this).attr("checked")){
			  str+=$(this).val()+","; 
		}
		})
		ajaxpost({
			name:'您确认要继续进行操作吗？操作将无法撤销！',
			url:"{$url(admin_list_content/batch)}",
			data:{status: status, id:str,fid:'{$form_info.id}'},
			tip:1,
			success:function(){
				ajaxload();	
			}
		});
	}

});


</script>